<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<link rel="stylesheet" href="static/css/bootstrap.css" />
		<link rel="stylesheet" href="static/css/custom.css" />
	</head>

	<body>
		<div id="app">
			
		</div>
		<template id="home">
			<div>
				<h1>Home</h1>
				<p>{{msg}}</p>
			</div>
		</template>
		<template id="about">
			<div>
			  <h1>About</h1>
			  <p>This is the tutorial about vue-router.</p>
			</div>
		</template>
	</body>
	<script src="static/js/vue-v1.0.25.js"></script>
	<script src="static/js/vue-router-v0.7.13.js"></script>
	<script>
		/* 创建组件构造器  */
		var Home = Vue.extend({
			template: '#home',
			data: function() {
				return {
					msg: 'Hello, vue router!'
				}
			}
		})

		var About = Vue.extend({
			template: '#about'
		})

		/* 创建路由器  */
		var router = new VueRouter()

		/* 创建路由映射  */
		router.map({
			'/home': {
				component: Home
			},
			'/about': {
				component: About
			}
		})

		router.redirect({
			'/': '/home'
		})

		/* 启动路由  */
		var App = Vue.extend({})
		router.start(App, '#app')
	</script>

</html>